**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"


**# Bookmark #2 Table S10 Panel A: Rural Hukou Holders
use "$outfile/City_regression.dta",clear

reghdfe codemission c.rural##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",replace ctitle("COD Emission") ///
keep(1.post#c.rural rural 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)


*Firm-level COD Emission
use "$outfile/Firm_regression.dta",clear

reghdfe codemission c.rural##i.post,absorb(i.id i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("COD Emission") ///
keep(1.post#c.rural rural 1.post) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)


*Firm Entry
use "$outfile/Firm_entry_regression.dta",clear

reghdfe entrynum c.rural##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("Firm Entry") ///
keep(1.post#c.rural rural 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

*Firm Exit
use "$outfile/Firm_exit_regression.dta",clear

reghdfe exitnum c.rural##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("Firm Exit") ///
keep(1.post#c.rural rural 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

**# Bookmark #3 Table S10 Panel B: Skilled Occupation Workers
*City-level COD Emission
use "$outfile/City_regression.dta",clear

reghdfe codemission c.occupation##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("COD Emission") ///
keep(1.post#c.occupation occupation 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)


*Firm-level COD Emission
use "$outfile/Firm_regression.dta",clear

reghdfe codemission c.occupation##i.post,absorb(i.id i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("COD Emission") ///
keep(1.post#c.occupation occupation 1.post) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)


*Firm Entry
use "$outfile/Firm_entry_regression.dta",clear

reghdfe entrynum c.occupation##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("Firm Entry") ///
keep(1.post#c.occupation occupation 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

*Firm Exit
use "$outfile/Firm_exit_regression.dta",clear

reghdfe exitnum c.occupation##i.post,absorb(i.city i.province#i.year) cluster(i.province i.year)

outreg2 using "$results/Table S10.xls",append ctitle("Firm Exit") ///
keep(1.post#c.occupation occupation 1.post) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)
